package com.zlp.socket;

import java.io.*;
import java.net.Socket;
import java.util.Scanner;

/**
 * @Author: zhulaiping
 * @Date: 2021/10/26 15:50
 */
public class SocketTest1Client {

    public static void main(String[] args) throws IOException {
        int port = 7000;
        String host = "localhost";

        // 创建一个套接字并将其连接到指定端口号
        Socket socket = new Socket(host, port);

        OutputStream outputStream = socket.getOutputStream();

        FileInputStream fis = new FileInputStream(new File("C:\\Users\\zhulaiping\\Desktop\\缺陷管理资料\\ui地址.txt"));
        byte[] arr = new byte[1024];
        int len = 0;
        while ((len = fis.read(arr)) != -1){
            outputStream.write(arr,0,len);
        }

        fis.close();
        socket.close();
    }
}
